package offer;

public class offer_0066 {
    public int[] constructArr(int[] a) {
        int len=a.length;
        if(len==0) return new int[0];
        int[] left=new int[len];
        int[] right=new int[len];
        left[0]=1;
        right[len-1]=1;
        for(int i=1;i<len;++i){
            left[i]=left[i-1]*a[i-1];
            right[len-i-1]=right[len-i]*a[len-i];
        }
        int[] result=new int[len];
        for(int i=0;i<len;++i){
            result[i]=left[i]*right[i];
        }
        return result;
    }
}
